<template>
    <div>
        <HomeHeader  :type_="type_"></HomeHeader>
        <v-content>
            <v-container ><v-card>{{dep_name}}{{date}}<v-card ref="form">
                <v-simple-table>
                    <v-row></v-row>
                        <thead>
                        <tr>
                            <th class="text-left" v-for="(item,i) in items" :key="i">{{item}}</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,i) in getdata" :key="i">
                            <td width="25%">{{ item.doc_name }}</td>
                            <td><v-btn @click="_paiban(item.doc_id,'morning')">{{item._morning}}</v-btn></td>
                            <td><v-btn @click="_paiban(item.doc_id,'afternoon')">{{item._afternoon}}</v-btn></td>
                        </tr>
                        </tbody>

                </v-simple-table>
<!--                <v-btn @click="test">test</v-btn>-->
            </v-card></v-card></v-container >
        </v-content></div>
</template>
<script>
export default {
  name:"Home",
    data () {
        return {
            type_:'adm',
            dep_id:this.$route.query.dep_id,
            dep_name:this.$route.query.dep_name,
            date:this.$route.query.date,
            items:['','上午','下午'],
            getdata: [],
        }
    },methods: {
      _paiban(doc_id,time) {
          var params ={
              doc_id:doc_id,
              dep_id:this.dep_id,
              app_date:this.date,
              app_time:time,
              _option:'1005'}
          this.$http.post(params,2).then((res)=>{
              let { resultCode, resultObject, resultMsg } = res
              // alert(resultCode)
              if (resultCode === '0') {
                  if (resultObject) {
                      this.getdata = resultObject.dataList

                  } else {
                      this.getdata = []
                  }
              } else {
                  this.getdata = []
                  this.response=resultMsg
              }this._begin()
          })
      },
        _begin(){
            var params ={
                dep_id:this.$route.query.dep_id,
                // dep_name:this.$route.query.dep_name,
                app_date:this.$route.query.date,
                _option:'1015'}
            this.$http.post(params,2).then((res)=>{
                let { resultCode, resultObject, resultMsg } = res
                // alert(resultCode)
                if (resultCode === '0') {
                    if (resultObject) {
                        this.getdata = resultObject.dataList

                    } else {
                        this.getdata = []
                    }
                } else {
                    this.getdata = []
                    this.response=resultMsg
                }
            })
        }
    },mounted(){
          this._begin()

    }
 }
</script>

<style scoped>
</style>

